from django.utils.deprecation import MiddlewareMixin
from django.middleware.security import SecurityMiddleware


class CoreMiddle(MiddlewareMixin):

    def process_response(self, request, response):
        if request.method == 'OPTIONS':  # 处理了非简单请求
            response['Access-Control-Allow-Headers'] = 'Content-Type,authorization'
        # 处理了简单请求
        response['Access-Control-Allow-Origin'] = '*'
        return response
